package saleMarket.service.authority;


import saleMarket.dao.authority.ActorDao;
import saleMarket.domain.authority.Actor;
import util.JdbcHelper;

import java.sql.Connection;
import java.sql.SQLException;

public final class ActorService {
  private static final ActorDao actorDao = ActorDao.getInstance();
  private static final ActorService actorService = new ActorService();

  public static ActorService getInstance() {
    return actorService;
  }

  public Actor find(Integer id) throws SQLException {
    //创建连接对象
    Connection connection = JdbcHelper.getConn();
    Actor actor = actorDao.find(connection,id);
    //关闭连接
    JdbcHelper.close(connection);
    return actor;
  }
  public Integer add() throws SQLException {
    //创建连接对象
    Connection connection = JdbcHelper.getConn();
    int actorId = actorDao.add(connection);
    //关闭连接
    JdbcHelper.close(connection);
    return actorId;
  }
}
